import { FootToolbar } from '@/components/footToolbar';
import { HeaderToolbar } from '@/components/headerToolbar';
import { udp } from '@cscec/udp-mobile-ui';
import {
  Checkbox,
  List,
  Image
} from 'antd-mobile';
import styles from './index.less'

const TextbookPageDetail = () => {
   const {id,name,imgurl} = udp.getQueryValue()
    console.log(id,name,imgurl)
  // 所有学习方式
   const allCourses =[{ id:1,title:"教材学习"},{id:2,title:"课后练习题"}];

  return (
    <div className={styles["textbook-container"]}>
      {/* 头部 */}
      <HeaderToolbar/>
      <div className={styles["content-wrapper"]}>
        {/* 最近在学部分 */}
        <section className={styles["recent-section"]}>
          <h2 className={styles["section-title"]}>最近在学</h2>
          <div className={styles["recent-courses"]}>
              <div className={styles["media-container"]}>
              <Image lazy className={styles["media-img"]} src={imgurl}/>
              <div className={styles["media-content"]}>
                <p>{name}</p>
              </div>
            </div>
          </div>
        </section>

        {/* 课程名称部分 */}
        <section className={styles["all-courses-section"]}>
          <h2 className={styles["section-title"]}>课程内容</h2>
          <List className={styles["course-list"]}>
            {allCourses.map(course => (
              <List.Item
                key={course.id}
                prefix={
                  <Checkbox 
                    className={styles["list-checkbox"]}
                  />
                }
                className={styles["course-list-item"]}
              >
                <div className={styles["list-item-content"]} onClick={async ()=>{
                    udp.open('/Schme',{id:id,name:name,imgurl:imgurl,})
                  }}>
                  <span className={styles["course-title"]}>{course.title}</span>
                </div>
              </List.Item>
            ))}
          </List>
        </section>
      </div>

      {/* 底部导航 */}
      <FootToolbar/>
    </div>
  );
};

export default TextbookPageDetail;